package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.SignUpRefund;
import com.eling.elcms.travel.model.view.SignUpRefundView;
import com.eling.elcms.travel.service.ISignUpRefundManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SignUpRefundController extends BaseFormController{
	
	@Autowired
	private ISignUpRefundManager signUpRefundManager;
	
	@RequestMapping("/api/signuprefund/save")
    @ResponseBody
	public SignUpRefund save(@ModelAttribute@ModelFilling SignUpRefund data){
		return signUpRefundManager.save(data);
	}
	
	@RequestMapping("/api/signuprefund/{pkSettlementsRule}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkSignUpRefund){
		signUpRefundManager.remove(pkSignUpRefund);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/signuprefund/query")
    @ResponseBody
	public List<SignUpRefund> query(@ModelAttribute SignUpRefund cond){
		return signUpRefundManager.query(cond);
	}
	
	@RequestMapping("/api/signuprefund/search*")
	@ResponseBody
	public List<SignUpRefund> search(@ModelAttribute SearchCondition sc,@ModelAttribute SignUpRefund cond){
		sc.setQueryCondition(cond);
		return signUpRefundManager.search(sc);
	}
	
	@RequestMapping(value="/api/signuprefund/saveall")
    @ResponseBody
	public SignUpRefundView saveAll(@ModelAttribute SignUpRefundView data){
		return signUpRefundManager.saveAll(data);
	}
	
}
